<script setup>
import { ref } from "vue";
import { getMockTest } from "api";
const list = ref([]);
const development = process.env.NODE_ENV !== "development";
const handleRequest = () => {
  if (development) {
    uni.showToast({
      title: "开发环境下才生效，如需要生产环境请自行修改",
      duration: 2000,
      icon: "error",
    });
    return;
  }
  getMockTest().then((res) => {
    console.log(res);
    if (res.code === 200) {
      list.value = res.data.list;
    }
  });
};
</script>

<template>
  <view class="container">
    <s-nav-bar />
    <view class="container-main" flex flex-col>
      <view p-y-4>{{ list }}</view>
      <uv-button
        type="primary"
        text="触发请求"
        @click="handleRequest()"
      ></uv-button>
    </view>
  </view>
</template>

<style lang="scss" scoped></style>
